﻿@model SYJ.Model.Entities.SysPermission
@using SYJ.Model.Entities
@{
    //ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout2.cshtml";
}

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>系统登录</legend>
</fieldset>

<form class="layui-form" action="" id="form1" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">登录账户</label>
        <div class="layui-input-inline">
            <input type="text" name="username" id="username" required  lay-verify="username" autocomplete="off" placeholder="请输入用户账号" value="huzhimin" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">密码框</label>
        <div class="layui-input-inline">
            <input type="password" name="password" id="password" required lay-verify="password" placeholder="请输入密码" autocomplete="off" value="123456" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">验证码</label>
        <div class="layui-input-inline">
            <input type="password" name="vercode" id="vercode" required lay-verify="required" placeholder="请输入验证码" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux"><img id="Img1" src="/admin/Login/ValidateCode" alt="看不清，请点击我！" onclick="this.src=this.src+'?'"
     width="80" height="38" style="vertical-align: middle; border: 0px;" /></div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">记住密码</label>
        <div class="layui-input-block">
            <input type="checkbox" name="rememberme" lay-skin="switch" lay-text="ON|OFF">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="form1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    layui.use(['layer', 'form','jquery'], function () {
        var  layer = layui.layer,form = layui.form,$=layui.jquery; //只有执行了这一步，部分表单元素才会自动修饰成功

        //……
        //自定义验证规则
        form.verify({
            username: function (value) {
                if (value.length < 6) {
                    return '用户账号至少得6个字符啊';
                }
            }
          , password: [/(.+){6,12}$/, '密码必须6到18位']
          , content: function (value) {
              layedit.sync(editIndex);
          }
        });
        //监听提交
        form.on('submit(form1)', function (data) {
            //layer.msg(JSON.stringify(data.field));
            return true;
        });
        $(function () {
            //保证登录页面不在弹出框里打开
            $(document).ready(function () {
               // windowwidth();
                if (window.top != window.self) {
                    window.top.location.href = window.location.href;

                    window.close();
                }

                $("#username").focus();
            });

            var error = '@ViewBag.Error';
            if (error != null && error != "") {
                layer.msg(error);
            }
        });
            
        

    });
   
</script>
    @*@foreach (SysPermission s in ViewBag.List)
    {

        <p> @s.display_name </p>
    }*@
